package com.kaifamiao.www.demo.Do25.pm;

import java.util.Random;

public class Person {
    String name;

    char gender;

    int age;

    boolean isMarry;


    /**
     * 判断两人是否可以结婚
     * this 你
     * @param person 对象
     * @return true 可以结婚 false 不能结婚
     *   同性不能结婚
     *   两人必须都是未婚
     *   男生年龄 >= 22  女生年龄 >= 20
     *
     */
    public boolean canMarry(Person person){
    if(this.gender=='女'&&this.gender!= person.gender&&this.age>=20&&person.age>=22&&!isMarry){
        return true;
    }else if(this.gender=='男'&&this.gender!= person.gender&&this.age>=22&&person.age>=20&&!isMarry){
        return true;
    }else{
        return false;
        }
    }
    public char getGender(){
        char gender[] = {'男','女'};
        Random g = new Random();
        int n = g.nextInt(2);
        return gender[n];
    }
     public int getAge(){
        Random a = new Random();
        int aa = a.nextInt(16,40);
        return aa;
     }
}
